Repository navigation
Micrometre conversions are always positive and finite; check and design exit 1 on errors (#93) - #133
Merged
Merged
Conversation
… 1 on errors (#93) - length_units (new, pure): the unit table, space_unit and to_micrometers, moved from physical_sizes (re-exported there). to_micrometers refuses a length that overflows or underflows in micrometres (1e308 m, 1e-320 pm) and an int beyond the float range with a ValueError naming it. - PhysicalSizes.micrometers converts with to_micrometers: None for such a size, never inf; _same_length is False for a non-finite size, so inf is never "the same" as another size. - Header sizes (TIFF and OME-Zarr) that do not convert, and an OME-Zarr scale product that overflows, are None with the reason in PhysicalSizes.invalid, named by invalid_physical_calibration; calibration_entry refuses a stated one. - CLI: check exits 1 on a design it cannot read, design exits 1 when it prints repeat_group_conflict or invalid_experiment_design. - Contract, user guide, plan question 66, AGENTS map; baseline lowered (physical_sizes.py now under 600 lines). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
The test asserted the old status 0 for a refused design that 'check' prints as an error; the new status is 1, as 'run' gives for the same design. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
guijacquemet
marked this pull request as ready for review
November 2, 2026 20:26
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
…1, as run stops on it (#133 review) check described the conflict in its design summary but exited 0. The filter that design uses (design_issues without design_not_confirmed) is now cli_design.design_errors, shared by both commands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
…ibration; agree the warning with its count (#133 review) An OME (PhysicalSize*, TimeIncrement) or ImageJ (spacing, finterval, a resolution of 0 with a unit) size that is itself not a positive finite number was silently None; it is now named in PhysicalSizes.invalid, the TIFF counterpart of #94. The warning said '1 image give ... their metadata ... these images are'; it now agrees with the count. Plan question 66 records the coordinator's answers for the owner to confirm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
…_sizes; shrink the baseline Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
Contributor
Author
|
Independent review: merged as 491150a (merge commit). The branch was auto-deleted and has been restored at 88f3202. What I verified
Fixed in review
Gate (Linux, Python 3.13, §9 figures (measured)
Left open (already the behaviour on main): Generated by Claude Code |
guijacquemet
pushed a commit
that referenced
this pull request
Nov 2, 2026
Conflicts in plan §10 and §12 only: main's entry and question 66 kept, PP-12's question renumbered 67, its references updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
guijacquemet
pushed a commit
that referenced
this pull request
Nov 2, 2026
Plan question 66 is now #133's; this PR's become 67 and 68. Baseline: this PR's lower metadata.py figures, #133's removal of the physical_sizes entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
This was referenced Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #93
Also fixes the CLI exit-status mismatch found in the review of #130, and three gaps found while implementing (fixed in review).
Summary (by module)
length_units(new, pure): the unit table,space_unit,to_micrometers,SPACE_UNITSandUnsupportedUnitError, moved out ofphysical_sizes, which re-exports them (MorphoFeaturecalibration.pyand MorphoRelateio/headers.pyimport them fromphysical_sizes; checked).to_micrometersalways returns a positive finite number: an overflow (1e308 mgivesinf), an underflow (1e-320 pmgives0.0) or an int beyond the float range (10**400) raises aValueErrornaming the value and unit.physical_sizes:PhysicalSizes.micrometersconverts withto_micrometersand returns None for such a size, neverinf;same_pixel_sizereturns None andpixel_size_groupsleaves the size out (both raised before)._same_lengthis False when either size is not finite.PhysicalSizes.invalid; so is an OME-Zarr level-0 scale times the image's scale that overflows or underflows.PhysicalSizeX/Y/Z,TimeIncrement) or ImageJ (spacing,finterval, a resolution tag of 0 with a unit) size that is itselfinf, NaN, zero, negative or not a number is also recorded ininvalid(before, silently None): the TIFF counterpart of [Sad Catapella B6][Scientific QA] Malformed explicit NGFF coordinate transforms are silently treated as unknown calibration #94.pixel_size_checks:invalid_physical_calibrationnames these images with the value; (review) its message agrees with the count ("1 image gives a calibration in its metadata ... this image is", before "1 image give ... their ... these images are").calibration: a stated size that does not convert is refused, socalibration.csvandcalibratename the line or option.cli:checkexits with 1 on an experiment design it cannot read; (review) and on a design withrepeat_group_conflictorinvalid_experiment_design, now printed as an error after the design summary (before, described in the summary with exit 0, whilerunstops on it). The filter is shared withdesignascli_design.design_errors.cli_design:designexits with 1 when the design it prints hasrepeat_group_conflictorinvalid_experiment_design, also after writing a change.run,masks,calibrateandconvertalready return 1 on every error they print.Decisions (plan §12 question 66; decided, pending the owner's confirmation)
Coordinator's answers in review, recorded in the plan for the owner to confirm:
invalid_physical_calibration; the image uncalibrated with the reason), consistent with the owner's [Sad Catapella B6][Scientific QA] Malformed explicit NGFF coordinate transforms are silently treated as unknown calibration #94 decision. A stated size that does not fit is refused.designexiting 1 after a write that leaves a conflict is accepted.Question number 66 follows the highest on main (64 and 65 from #128).
Tests
tests/test_micrometre_conversion.py(36 tests) andtests/test_cli_exit_status.py(4 tests). The review's 13 new tests fail on the PR head before the review fixes (12 conversion/message, 1 exit status)..[dev,notebook,zarr], root): ruff check and format clean (190 files),tools/check.py --rulesclean, pytest 1941 passed, 2 skipped (expected:test_discovery.py:665root permissions,test_cli_log.py:164case-sensitive file system), 1 warning.§9 figures (measured at 88f3202)
physical_sizes.py597 lines (684 on main; baseline entry removed).length_units.py161,cli.py341,pixel_size_checks.py312,calibration.py464,cli_design.py156.cli._checkandngff_physical_sizes, 45 executable lines; most statements_check39.cli._check9;to_micrometers,ngff_physical_sizes7._sizes7.physical_sizes.pyfile length;_ome_sizes,_imagej_sizesnow have docstrings); none added.# noqacount unchanged (54).length_unitsdeclaredpure(no I/O).Known, not in this PR
to_micrometersrefuses NumPy scalars other thanfloat64(np.float32,np.int64: "not a number"), as on main.https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
🤖 Generated with Claude Code